Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed "Vehicle disappearing when grabbing another veh inside" #35641

Merged

Conversation

ipcyborg
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Vehicle disappearing when grabbing another veh inside"

Purpose of change

Fixes #34514
Function map::displace_vehicle takes only two coordinates, and tries to find the vehicle to displace by coordinate.
This could lead to an issue when vehicle is detected incorrectly.
But it is not even required, since vehicle is already known.

Describe the solution

The solution is to specify the vehicle in map::displace_vehicle parameters.

Describe alternatives you've considered

Probably some additional optimization, like removing our_i.

Testing

Tested on save file provided in #34514: only the lifter is grabbed, no vehicle disappeared.
Tested with cata_test-tiles.

Additional context

None

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions labels Nov 22, 2019
Copy link
Contributor

@mlangsdorf mlangsdorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but since the p argument to displace_vehicle is always veh->global_pos3(), consider removing it from the argument list and retrieving it inside of map::displace_vehicle()

src/map.cpp Outdated Show resolved Hide resolved
Removed global vehicle position parameter.
Astyle for tests folder.
@ipcyborg ipcyborg requested a review from BevapDin November 25, 2019 07:50
@kevingranade kevingranade merged commit 576881f into CleverRaven:master Dec 9, 2019
@ipcyborg ipcyborg deleted the fix-35583-vehicle-displace branch December 9, 2019 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vehicle disappearing when grabbing another veh inside(?)
5 participants